home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 10 / BBS In A Box Volume X (AMUG) (January 1994).bin / Files / Prog / U-Z / VideoToolBox.cpt / VideoToolboxSources / Binomial.c < prev    next >
MacBinary  |  1993-03-07  |  8.8 KB  |  [TEXT/KAHL]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
66% dexvert Compact Compressed (Unix) (archive/compact) ext Supported
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, inited, Sun Mar 7 16:08:36 1993, modified Sun Mar 7 16:08:36 1993, creator Think C, type ASCII, 8241 bytes "Binomial.c" , at 0x20b1 428 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[KAHL]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 0a 42 69 6e 6f 6d 69 | 61 6c 2e 63 00 00 00 00 |..Binomi|al.c....|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4b 41 48 | 4c 01 00 00 00 00 00 00 |.TEXTKAH|L.......|
|00000050| 00 00 00 00 00 20 31 00 | 00 01 ac a7 c0 14 d4 a7 |..... 1.|........|
|00000060| c0 14 d4 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 36 1b 00 00 |........|....6...|
|00000080| 2f 2a 0d 42 69 6e 6f 6d | 69 61 6c 2e 63 0d 43 6f |/*.Binom|ial.c.Co|
|00000090| 70 79 72 69 67 68 74 20 | 28 63 29 20 31 39 39 30 |pyright |(c) 1990|
|000000a0| 2c 31 39 39 31 2c 31 39 | 39 32 20 44 65 6e 69 73 |,1991,19|92 Denis|
|000000b0| 20 47 2e 20 50 65 6c 6c | 69 0d 0d 56 61 72 69 6f | G. Pell|i..Vario|
|000000c0| 75 73 20 72 6f 75 74 69 | 6e 65 73 20 74 68 61 74 |us routi|nes that|
|000000d0| 20 64 65 61 6c 20 77 69 | 74 68 20 42 69 6e 6f 6d | deal wi|th Binom|
|000000e0| 69 61 6c 20 73 74 61 74 | 69 73 74 69 63 73 2c 20 |ial stat|istics, |
|000000f0| 69 6e 63 6c 75 64 69 6e | 67 20 67 65 6e 65 72 61 |includin|g genera|
|00000100| 74 69 6e 67 20 72 61 6e | 64 6f 6d 0d 73 61 6d 70 |ting ran|dom.samp|
|00000110| 6c 65 73 20 61 6e 64 20 | 63 6f 6d 70 75 74 69 6e |les and |computin|
|00000120| 67 20 63 6f 6e 66 69 64 | 65 6e 63 65 20 69 6e 74 |g confid|ence int|
|00000130| 65 72 76 61 6c 73 2e 0d | 0d 54 68 69 73 20 66 69 |ervals..|.This fi|
|00000140| 6c 65 20 63 6f 6e 74 61 | 69 6e 73 20 74 77 6f 20 |le conta|ins two |
|00000150| 67 65 6e 65 72 61 74 69 | 6f 6e 73 20 6f 66 20 72 |generati|ons of r|
|00000160| 6f 75 74 69 6e 65 73 20 | 74 68 61 74 20 67 65 6e |outines |that gen|
|00000170| 65 72 61 74 65 20 63 6f | 6e 66 69 64 65 6e 63 65 |erate co|nfidence|
|00000180| 0d 69 6e 74 65 72 76 61 | 6c 73 2e 20 54 68 65 20 |.interva|ls. The |
|00000190| 6f 72 69 67 69 6e 61 6c | 20 72 6f 75 74 69 6e 65 |original| routine|
|000001a0| 73 20 42 69 6e 6f 6d 69 | 61 6c 55 70 70 65 72 42 |s Binomi|alUpperB|
|000001b0| 6f 75 6e 64 20 61 6e 64 | 20 42 69 6e 6f 6d 69 61 |ound and| Binomia|
|000001c0| 6c 4c 6f 77 65 72 42 6f | 75 6e 64 20 61 72 65 0d |lLowerBo|und are.|
|000001d0| 6f 6c 64 2c 20 62 75 74 | 20 61 72 65 20 6d 6f 72 |old, but| are mor|
|000001e0| 65 20 72 6f 62 75 73 74 | 2e 20 54 68 65 20 6e 65 |e robust|. The ne|
|000001f0| 77 20 72 6f 75 74 69 6e | 65 73 20 61 72 65 20 62 |w routin|es are b|
|00000200| 61 73 65 64 20 6f 6e 20 | 61 20 4e 75 6d 65 72 69 |ased on |a Numeri|
|00000210| 63 61 6c 20 52 65 63 69 | 70 65 73 20 69 6e 20 43 |cal Reci|pes in C|
|00000220| 0d 72 6f 75 74 69 6e 65 | 20 74 6f 20 63 6f 6d 70 |.routine| to comp|
|00000230| 75 74 65 20 74 68 65 20 | 69 6e 63 6f 6d 70 6c 65 |ute the |incomple|
|00000240| 74 65 20 62 65 74 61 20 | 66 75 6e 63 74 69 6f 6e |te beta |function|
|00000250| 2e 20 54 68 65 20 6e 65 | 77 20 72 6f 75 74 69 6e |. The ne|w routin|
|00000260| 65 73 20 61 64 64 20 6c | 69 74 74 6c 65 20 74 6f |es add l|ittle to|
|00000270| 0d 74 68 65 20 6f 6c 64 | 20 72 6f 75 74 69 6e 65 |.the old| routine|
|00000280| 73 2c 20 61 6e 64 20 72 | 65 71 75 69 72 65 20 74 |s, and r|equire t|
|00000290| 68 65 20 4e 75 6d 65 72 | 69 63 61 6c 20 52 65 63 |he Numer|ical Rec|
|000002a0| 69 70 65 73 20 69 6e 20 | 43 2c 20 73 6f 20 49 20 |ipes in |C, so I |
|000002b0| 63 6f 6d 6d 65 6e 74 65 | 64 20 74 68 65 6d 0d 6f |commente|d them.o|
|000002c0| 75 74 2e 20 54 68 65 20 | 6e 65 77 20 72 6f 75 74 |ut. The |new rout|
|000002d0| 69 6e 65 73 20 64 6f 20 | 68 61 76 65 20 74 68 65 |ines do |have the|
|000002e0| 20 61 64 76 61 6e 74 61 | 67 65 20 6f 66 20 61 6c | advanta|ge of al|
|000002f0| 6c 6f 77 69 6e 67 20 61 | 6e 20 61 72 62 69 74 72 |lowing a|n arbitr|
|00000300| 61 72 79 20 63 6f 6e 66 | 69 64 65 6e 63 65 2c 0d |ary conf|idence,.|
|00000310| 77 68 65 72 65 61 73 20 | 74 68 65 20 6f 6c 64 20 |whereas |the old |
|00000320| 72 6f 75 74 69 6e 65 73 | 20 77 65 72 65 20 68 61 |routines| were ha|
|00000330| 72 64 20 63 6f 64 65 64 | 20 74 6f 20 70 72 6f 64 |rd coded| to prod|
|00000340| 75 63 65 20 61 20 39 35 | 25 20 63 6f 6e 66 69 64 |uce a 95|% confid|
|00000350| 65 6e 63 65 20 69 6e 74 | 65 72 76 61 6c 2e 0d 0d |ence int|erval...|
|00000360| 48 49 53 54 4f 52 59 3a | 0d 31 2f 35 2f 39 31 20 |HISTORY:|.1/5/91 |
|00000370| 41 64 64 65 64 20 6e 65 | 77 20 62 69 6e 6f 6d 69 |Added ne|w binomi|
|00000380| 61 6c 20 72 6f 75 74 69 | 6e 65 73 2e 20 54 68 65 |al routi|nes. The|
|00000390| 73 65 20 72 6f 75 74 69 | 6e 65 73 20 6d 61 79 20 |se routi|nes may |
|000003a0| 62 65 20 0d 09 09 63 6f | 6d 6d 65 6e 74 65 64 20 |be ...co|mmented |
|000003b0| 6f 75 74 20 62 79 20 73 | 65 74 74 69 6e 67 20 4e |out by s|etting N|
|000003c0| 45 57 5f 42 49 4e 4f 4d | 49 41 4c 20 74 6f 20 7a |EW_BINOM|IAL to z|
|000003d0| 65 72 6f 2e 0d 31 2f 37 | 2f 39 31 20 52 65 77 72 |ero..1/7|/91 Rewr|
|000003e0| 6f 74 65 20 42 69 6e 6f | 6d 69 61 6c 55 70 70 65 |ote Bino|mialUppe|
|000003f0| 72 42 6f 75 6e 64 20 26 | 20 42 69 6e 6f 6d 69 61 |rBound &| Binomia|
|00000400| 6c 4c 6f 77 65 72 42 6f | 75 6e 64 20 74 6f 20 61 |lLowerBo|und to a|
|00000410| 6c 6c 6f 77 20 73 70 65 | 63 69 66 69 63 61 74 69 |llow spe|cificati|
|00000420| 6f 6e 20 6f 66 20 74 68 | 65 0d 09 09 64 65 73 69 |on of th|e...desi|
|00000430| 72 65 64 20 63 6f 6e 66 | 69 64 65 6e 63 65 20 6f |red conf|idence o|
|00000440| 66 20 74 68 65 20 69 6e | 74 65 72 76 61 6c 2e 0d |f the in|terval..|
|00000450| 34 2f 32 34 2f 39 32 09 | 64 67 70 09 41 64 64 65 |4/24/92.|dgp.Adde|
|00000460| 64 20 42 69 6e 6f 6d 69 | 61 6c 53 61 6d 70 6c 65 |d Binomi|alSample|
|00000470| 51 75 69 63 6b 6c 79 28 | 29 2e 0d 34 2f 32 37 2f |Quickly(|)..4/27/|
|00000480| 39 32 09 64 67 70 09 4f | 6f 70 73 2e 20 49 20 6a |92.dgp.O|ops. I j|
|00000490| 75 73 74 20 6e 6f 74 69 | 63 65 64 20 74 68 61 74 |ust noti|ced that|
|000004a0| 20 74 68 69 73 20 66 69 | 6c 65 20 77 61 73 20 61 | this fi|le was a|
|000004b0| 6c 77 61 79 73 20 69 6e | 63 6c 75 64 69 6e 67 20 |lways in|cluding |
|000004c0| 6e 72 2e 68 2c 20 77 68 | 69 63 68 20 79 6f 75 27 |nr.h, wh|ich you'|
|000004d0| 64 0d 09 09 09 6f 6e 6c | 79 20 68 61 76 65 20 69 |d....onl|y have i|
|000004e0| 66 20 79 6f 75 20 6f 77 | 6e 20 74 68 65 20 4e 75 |f you ow|n the Nu|
|000004f0| 6d 65 72 69 63 61 6c 20 | 52 65 63 69 70 65 73 2e |merical |Recipes.|
|00000500| 20 49 20 6d 6f 76 65 64 | 20 74 68 65 20 69 6e 63 | I moved| the inc|
|00000510| 6c 75 64 65 20 73 74 61 | 74 65 6d 65 6e 74 0d 09 |lude sta|tement..|
|00000520| 09 09 64 6f 77 6e 20 69 | 6e 73 69 64 65 20 74 68 |..down i|nside th|
|00000530| 65 20 63 6f 6e 64 69 74 | 69 6f 6e 61 6c 20 62 65 |e condit|ional be|
|00000540| 6c 6f 77 2c 20 77 68 65 | 72 65 20 69 74 20 62 65 |low, whe|re it be|
|00000550| 6c 6f 6e 67 73 2e 20 0d | 2a 2f 0d 23 69 6e 63 6c |longs. .|*/.#incl|
|00000560| 75 64 65 20 22 56 69 64 | 65 6f 54 6f 6f 6c 62 6f |ude "Vid|eoToolbo|
|00000570| 78 2e 68 22 0d 23 69 6e | 63 6c 75 64 65 20 3c 6d |x.h".#in|clude <m|
|00000580| 61 74 68 2e 68 3e 0d 0d | 23 64 65 66 69 6e 65 20 |ath.h>..|#define |
|00000590| 4e 45 57 5f 42 49 4e 4f | 4d 49 41 4c 20 30 0d 0d |NEW_BINO|MIAL 0..|
|000005a0| 6c 6f 6e 67 20 42 69 6e | 6f 6d 69 61 6c 53 61 6d |long Bin|omialSam|
|000005b0| 70 6c 65 28 64 6f 75 62 | 6c 65 20 70 2c 6c 6f 6e |ple(doub|le p,lon|
|000005c0| 67 20 6e 29 0d 2f 2a 0d | 52 65 74 75 72 6e 73 20 |g n)./*.|Returns |
|000005d0| 61 20 61 20 73 61 6d 70 | 6c 65 20 66 72 6f 6d 20 |a a samp|le from |
|000005e0| 61 20 62 69 6e 6f 6d 69 | 61 6c 20 64 69 73 74 72 |a binomi|al distr|
|000005f0| 69 62 75 74 69 6f 6e 3a | 20 6e 75 6d 62 65 72 20 |ibution:| number |
|00000600| 6f 66 20 68 65 61 64 73 | 20 69 6e 20 6e 20 66 6c |of heads| in n fl|
|00000610| 69 70 73 20 6f 66 0d 63 | 6f 69 6e 20 77 69 74 68 |ips of.c|oin with|
|00000620| 20 61 20 70 72 6f 62 61 | 62 69 6c 69 74 79 20 70 | a proba|bility p|
|00000630| 20 6f 66 20 68 65 61 64 | 73 20 6f 6e 20 65 61 63 | of head|s on eac|
|00000640| 68 20 66 6c 69 70 2e 20 | 54 68 69 73 20 69 73 20 |h flip. |This is |
|00000650| 66 69 6e 65 20 69 66 20 | 6e 20 69 73 20 73 6d 61 |fine if |n is sma|
|00000660| 6c 6c 2e 20 48 6f 77 65 | 76 65 72 2c 0d 69 66 20 |ll. Howe|ver,.if |
|00000670| 6e 20 69 73 20 6c 61 72 | 67 65 2c 20 65 2e 67 2e |n is lar|ge, e.g.|
|00000680| 20 6e 3e 31 30 30 2c 20 | 74 68 65 6e 20 74 68 69 | n>100, |then thi|
|00000690| 73 20 72 6f 75 74 69 6e | 65 20 77 69 6c 6c 20 62 |s routin|e will b|
|000006a0| 65 20 72 61 74 68 65 72 | 20 73 6c 6f 77 2c 20 61 |e rather| slow, a|
|000006b0| 6e 64 20 79 6f 75 20 6d | 61 79 20 70 72 65 66 65 |nd you m|ay prefe|
|000006c0| 72 0d 74 6f 20 75 73 65 | 20 74 68 65 20 6d 6f 72 |r.to use| the mor|
|000006d0| 65 20 65 6c 61 62 6f 72 | 61 74 65 20 4e 75 6d 65 |e elabor|ate Nume|
|000006e0| 72 69 63 61 6c 20 52 65 | 63 69 70 65 73 20 62 6e |rical Re|cipes bn|
|000006f0| 6c 64 65 76 28 29 20 72 | 6f 75 74 69 6e 65 2e 0d |ldev() r|outine..|
|00000700| 2a 2f 0d 7b 0d 09 6c 6f | 6e 67 20 6b 2c 69 3b 0d |*/.{..lo|ng k,i;.|
|00000710| 0d 09 6b 3d 30 3b 0d 09 | 66 6f 72 28 69 3d 30 3b |..k=0;..|for(i=0;|
|00000720| 69 3c 6e 3b 69 2b 2b 29 | 20 69 66 28 70 3e 55 6e |i<n;i++)| if(p>Un|
|00000730| 69 66 6f 72 6d 53 61 6d | 70 6c 65 28 29 29 6b 2b |iformSam|ple())k+|
|00000740| 2b 3b 0d 09 72 65 74 75 | 72 6e 20 6b 3b 0d 7d 0d |+;..retu|rn k;.}.|
|00000750| 0d 69 6e 74 20 42 69 6e | 6f 6d 69 61 6c 53 61 6d |.int Bin|omialSam|
|00000760| 70 6c 65 51 75 69 63 6b | 6c 79 28 69 6e 74 20 6e |pleQuick|ly(int n|
|00000770| 29 0d 2f 2f 20 44 6f 65 | 73 20 6e 20 63 6f 69 6e |).// Doe|s n coin|
|00000780| 20 66 6c 69 70 73 20 61 | 6e 64 20 72 65 74 75 72 | flips a|nd retur|
|00000790| 6e 73 20 74 68 65 20 6e | 75 6d 62 65 72 20 6f 66 |ns the n|umber of|
|000007a0| 20 68 65 61 64 73 2e 20 | 56 65 72 79 20 66 61 73 | heads. |Very fas|
|000007b0| 74 2e 0d 7b 0d 09 72 65 | 67 69 73 74 65 72 20 69 |t..{..re|gister i|
|000007c0| 6e 74 20 69 2c 6b 3d 30 | 3b 0d 09 72 65 67 69 73 |nt i,k=0|;..regis|
|000007d0| 74 65 72 20 73 68 6f 72 | 74 20 72 3b 0d 09 0d 09 |ter shor|t r;....|
|000007e0| 66 6f 72 28 69 3d 6e 3b | 69 3e 3d 38 3b 69 2d 3d |for(i=n;|i>=8;i-=|
|000007f0| 38 29 7b 0d 09 09 72 3d | 72 61 6e 64 55 28 29 3b |8){...r=|randU();|
|00000800| 09 2f 2f 20 55 73 65 20 | 6f 6e 6c 79 20 74 68 65 |.// Use |only the|
|00000810| 20 75 70 70 65 72 20 38 | 20 62 69 74 73 2c 20 77 | upper 8| bits, w|
|00000820| 68 69 63 68 20 61 72 65 | 20 72 65 70 75 74 65 64 |hich are| reputed|
|00000830| 20 74 6f 20 62 65 20 6d | 6f 72 65 20 72 61 6e 64 | to be m|ore rand|
|00000840| 6f 6d 2e 0d 09 09 69 66 | 28 72 3c 30 29 6b 2b 2b |om....if|(r<0)k++|
|00000850| 3b 0d 09 09 72 3c 3c 3d | 31 3b 0d 09 09 69 66 28 |;...r<<=|1;...if(|
|00000860| 72 3c 30 29 6b 2b 2b 3b | 0d 09 09 72 3c 3c 3d 31 |r<0)k++;|...r<<=1|
|00000870| 3b 0d 09 09 69 66 28 72 | 3c 30 29 6b 2b 2b 3b 0d |;...if(r|<0)k++;.|
|00000880| 09 09 72 3c 3c 3d 31 3b | 0d 09 09 69 66 28 72 3c |..r<<=1;|...if(r<|
|00000890| 30 29 6b 2b 2b 3b 0d 09 | 09 72 3c 3c 3d 31 3b 0d |0)k++;..|.r<<=1;.|
|000008a0| 09 09 69 66 28 72 3c 30 | 29 6b 2b 2b 3b 0d 09 09 |..if(r<0|)k++;...|
|000008b0| 72 3c 3c 3d 31 3b 0d 09 | 09 69 66 28 72 3c 30 29 |r<<=1;..|.if(r<0)|
|000008c0| 6b 2b 2b 3b 0d 09 09 72 | 3c 3c 3d 31 3b 0d 09 09 |k++;...r|<<=1;...|
|000008d0| 69 66 28 72 3c 30 29 6b | 2b 2b 3b 0d 09 09 72 3c |if(r<0)k|++;...r<|
|000008e0| 3c 3d 31 3b 0d 09 09 69 | 66 28 72 3c 30 29 6b 2b |<=1;...i|f(r<0)k+|
|000008f0| 2b 3b 0d 09 09 72 3c 3c | 3d 31 3b 0d 09 7d 0d 09 |+;...r<<|=1;..}..|
|00000900| 69 66 28 69 3e 30 29 7b | 0d 09 09 72 3d 72 61 6e |if(i>0){|...r=ran|
|00000910| 64 55 28 29 3b 0d 09 09 | 66 6f 72 28 3b 69 3e 30 |dU();...|for(;i>0|
|00000920| 3b 69 2d 2d 29 7b 0d 09 | 09 09 69 66 28 72 3c 30 |;i--){..|..if(r<0|
|00000930| 29 6b 2b 2b 3b 0d 09 09 | 09 72 3c 3c 3d 31 3b 0d |)k++;...|.r<<=1;.|
|00000940| 09 09 7d 0d 09 7d 0d 09 | 72 65 74 75 72 6e 20 6b |..}..}..|return k|
|00000950| 3b 0d 7d 0d 0d 2f 2a 0d | 42 69 6e 6f 6d 69 61 6c |;.}../*.|Binomial|
|00000960| 55 70 70 65 72 42 6f 75 | 6e 64 20 61 6e 64 20 42 |UpperBou|nd and B|
|00000970| 69 6e 6f 6d 69 61 6c 4c | 6f 77 65 72 42 6f 75 6e |inomialL|owerBoun|
|00000980| 64 20 72 65 74 75 72 6e | 20 61 20 50 20 63 6f 6e |d return| a P con|
|00000990| 66 69 64 65 6e 63 65 20 | 69 6e 74 65 72 76 61 6c |fidence |interval|
|000009a0| 20 66 6f 72 20 74 68 65 | 0d 75 6e 64 65 72 6c 79 | for the|.underly|
|000009b0| 69 6e 67 20 62 69 6e 6f | 6d 69 61 6c 20 70 72 6f |ing bino|mial pro|
|000009c0| 62 61 62 69 6c 69 74 79 | 20 61 73 73 75 6d 65 64 |bability| assumed|
|000009d0| 20 74 6f 20 68 61 76 65 | 20 67 65 6e 65 72 61 74 | to have| generat|
|000009e0| 65 64 20 74 68 65 20 64 | 61 74 61 2e 0d 0d 54 68 |ed the d|ata...Th|
|000009f0| 65 20 66 6f 72 6d 75 6c | 61 20 69 73 20 62 61 73 |e formul|a is bas|
|00000a00| 65 64 20 6f 6e 20 61 20 | 47 61 75 73 73 69 61 6e |ed on a |Gaussian|
|00000a10| 20 61 70 70 72 6f 78 69 | 6d 61 74 69 6f 6e 2c 20 | approxi|mation, |
|00000a20| 73 6f 6c 76 69 6e 67 20 | 66 6f 72 20 74 68 65 20 |solving |for the |
|00000a30| 70 20 74 68 61 74 20 77 | 69 6c 6c 0d 70 75 74 20 |p that w|ill.put |
|00000a40| 74 68 65 20 6f 62 73 65 | 72 76 65 64 20 72 65 73 |the obse|rved res|
|00000a50| 75 6c 74 20 74 68 65 20 | 72 69 67 68 74 20 6e 75 |ult the |right nu|
|00000a60| 6d 62 65 72 20 6f 66 20 | 73 74 61 6e 64 61 72 64 |mber of |standard|
|00000a70| 20 64 65 76 69 61 74 69 | 6f 6e 73 20 61 77 61 79 | deviati|ons away|
|00000a80| 20 66 72 6f 6d 20 74 68 | 65 0d 6d 65 61 6e 2c 20 | from th|e.mean, |
|00000a90| 70 6c 75 73 20 6f 72 20 | 6d 69 6e 75 73 20 30 2e |plus or |minus 0.|
|00000aa0| 35 2c 20 61 73 20 61 20 | 22 63 6f 6e 74 69 6e 75 |5, as a |"continu|
|00000ab0| 69 74 79 20 63 6f 72 72 | 65 63 74 69 6f 6e 22 2e |ity corr|ection".|
|00000ac0| 0d 0d 54 68 69 73 20 69 | 73 20 74 68 65 20 62 65 |..This i|s the be|
|00000ad0| 73 74 20 66 6f 72 6d 75 | 6c 61 20 49 20 63 6f 75 |st formu|la I cou|
|00000ae0| 6c 64 20 66 69 6e 64 20 | 69 6e 20 6c 6f 6f 6b 69 |ld find |in looki|
|00000af0| 6e 67 20 74 68 72 6f 75 | 67 68 20 73 65 76 65 72 |ng throu|gh sever|
|00000b00| 61 6c 20 73 74 61 74 69 | 73 74 69 63 73 0d 62 6f |al stati|stics.bo|
|00000b10| 6f 6b 73 2e 20 48 6f 77 | 65 76 65 72 2c 20 74 68 |oks. How|ever, th|
|00000b20| 65 20 72 65 73 75 6c 74 | 20 68 61 73 20 74 6f 20 |e result| has to |
|00000b30| 62 65 20 74 61 6b 65 6e | 20 77 69 74 68 20 61 20 |be taken| with a |
|00000b40| 67 72 61 69 6e 20 6f 66 | 20 73 61 6c 74 20 62 65 |grain of| salt be|
|00000b50| 63 61 75 73 65 20 69 74 | 20 69 73 0d 6e 6f 74 20 |cause it| is.not |
|00000b60| 70 6f 73 73 69 62 6c 65 | 20 74 6f 20 70 72 6f 64 |possible| to prod|
|00000b70| 75 63 65 20 61 20 62 69 | 6e 6f 6d 69 61 6c 20 63 |uce a bi|nomial c|
|00000b80| 6f 6e 66 69 64 65 6e 63 | 65 20 69 6e 74 65 72 76 |onfidenc|e interv|
|00000b90| 61 6c 20 74 68 61 74 20 | 77 69 6c 6c 20 73 61 74 |al that |will sat|
|00000ba0| 69 73 66 79 20 74 68 65 | 0d 73 74 72 69 63 74 20 |isfy the|.strict |
|00000bb0| 64 65 66 69 6e 69 74 69 | 6f 6e 20 6f 66 20 61 20 |definiti|on of a |
|00000bc0| 63 6f 6e 66 69 64 65 6e | 63 65 20 69 6e 74 65 72 |confiden|ce inter|
|00000bd0| 76 61 6c 2c 20 6e 61 6d | 65 6c 79 20 6f 6e 65 20 |val, nam|ely one |
|00000be0| 74 68 61 74 20 77 69 6c | 6c 20 68 61 76 65 20 74 |that wil|l have t|
|00000bf0| 68 65 0d 73 70 65 63 69 | 66 69 65 64 20 70 72 6f |he.speci|fied pro|
|00000c00| 62 61 62 69 6c 69 74 79 | 20 50 20 6f 66 20 63 6f |bability| P of co|
|00000c10| 6e 74 61 69 6e 69 6e 67 | 20 74 68 65 20 75 6e 6b |ntaining| the unk|
|00000c20| 6e 6f 77 6e 20 62 75 74 | 20 66 69 78 65 64 20 70 |nown but| fixed p|
|00000c30| 61 72 61 6d 65 74 65 72 | 20 70 2e 20 54 68 61 74 |arameter| p. That|
|00000c40| 27 73 0d 62 65 63 61 75 | 73 65 2c 20 75 6e 6c 69 |'s.becau|se, unli|
|00000c50| 6b 65 20 74 68 65 20 4e | 6f 72 6d 61 6c 20 64 69 |ke the N|ormal di|
|00000c60| 73 74 72 69 62 75 74 69 | 6f 6e 2c 20 74 68 65 20 |stributi|on, the |
|00000c70| 42 69 6e 6f 6d 69 61 6c | 20 64 69 73 74 72 69 62 |Binomial| distrib|
|00000c80| 75 74 69 6f 6e 20 69 73 | 20 6e 6f 74 0d 74 72 61 |ution is| not.tra|
|00000c90| 6e 73 6c 61 74 69 6f 6e | 20 69 6e 76 61 72 69 61 |nslation| invaria|
|00000ca0| 6e 74 2e 20 45 2e 67 2e | 20 69 66 20 70 20 69 73 |nt. E.g.| if p is|
|00000cb0| 20 61 63 74 75 61 6c 6c | 79 20 7a 65 72 6f 20 74 | actuall|y zero t|
|00000cc0| 68 65 6e 20 74 68 65 20 | 74 72 75 65 20 63 6f 6e |hen the |true con|
|00000cd0| 66 69 64 65 6e 63 65 20 | 69 6e 74 65 72 76 61 6c |fidence |interval|
|00000ce0| 0d 41 4c 57 41 59 53 20 | 63 6f 6e 74 61 69 6e 73 |.ALWAYS |contains|
|00000cf0| 20 70 2e 0d 0d 49 20 67 | 61 76 65 20 73 6f 6d 65 | p...I g|ave some|
|00000d00| 20 74 68 6f 75 67 68 74 | 20 74 6f 20 74 61 6b 69 | thought| to taki|
|00000d10| 6e 67 20 61 20 42 61 79 | 65 73 69 61 6e 20 61 70 |ng a Bay|esian ap|
|00000d20| 70 72 6f 61 63 68 2c 20 | 61 73 73 75 6d 69 6e 67 |proach, |assuming|
|00000d30| 20 61 20 75 6e 69 66 6f | 72 6d 20 70 72 69 6f 72 | a unifo|rm prior|
|00000d40| 20 70 64 66 0d 66 6f 72 | 20 70 20 61 6e 64 20 74 | pdf.for| p and t|
|00000d50| 68 65 6e 20 63 6f 6d 70 | 75 74 69 6e 67 20 61 6e |hen comp|uting an|
|00000d60| 20 61 20 70 6f 73 74 65 | 72 69 6f 72 69 20 63 6f | a poste|riori co|
|00000d70| 6e 66 69 64 65 6e 63 65 | 20 69 6e 74 65 72 76 61 |nfidence| interva|
|00000d80| 6c 2e 20 54 68 69 73 20 | 63 61 6e 20 62 65 20 64 |l. This |can be d|
|00000d90| 6f 6e 65 2c 0d 62 75 74 | 20 69 74 27 73 20 68 61 |one,.but| it's ha|
|00000da0| 72 64 2e 20 49 20 63 6f | 6e 63 6c 75 64 65 64 20 |rd. I co|ncluded |
|00000db0| 74 68 61 74 20 69 74 27 | 73 20 70 6f 69 6e 74 6c |that it'|s pointl|
|00000dc0| 65 73 73 20 62 65 63 61 | 75 73 65 20 74 68 65 20 |ess beca|use the |
|00000dd0| 75 6e 69 66 6f 72 6d 20 | 70 64 66 0d 61 73 73 75 |uniform |pdf.assu|
|00000de0| 6d 70 74 69 6f 6e 20 69 | 73 20 75 73 75 61 6c 6c |mption i|s usuall|
|00000df0| 79 20 75 6e 77 61 72 72 | 61 6e 74 65 64 2e 0d 0d |y unwarr|anted...|
|00000e00| 45 76 65 6e 20 74 68 6f | 75 67 68 20 74 68 69 73 |Even tho|ugh this|
|00000e10| 20 63 6f 6e 66 69 64 65 | 6e 63 65 20 69 6e 74 65 | confide|nce inte|
|00000e20| 72 76 61 6c 20 69 73 20 | 75 6e 73 61 74 69 73 66 |rval is |unsatisf|
|00000e30| 61 63 74 6f 72 79 20 28 | 69 2e 65 2e 20 66 75 6e |actory (|i.e. fun|
|00000e40| 64 61 6d 65 6e 74 61 6c | 6c 79 0d 66 61 6c 73 65 |damental|ly.false|
|00000e50| 29 20 69 74 20 69 73 20 | 75 73 65 66 75 6c 20 69 |) it is |useful i|
|00000e60| 6e 20 70 72 61 63 74 69 | 63 65 20 73 69 6e 63 65 |n practi|ce since|
|00000e70| 20 69 74 20 74 79 70 69 | 63 61 6c 6c 79 20 62 65 | it typi|cally be|
|00000e80| 68 61 76 65 73 20 73 69 | 6d 69 6c 61 72 6c 79 20 |haves si|milarly |
|00000e90| 74 6f 20 74 68 65 0d 4e | 6f 72 6d 61 6c 20 63 61 |to the.N|ormal ca|
|00000ea0| 73 65 2c 20 77 68 69 63 | 68 20 69 73 20 74 68 65 |se, whic|h is the|
|00000eb0| 6f 72 65 74 69 63 61 6c | 6c 79 20 73 6f 75 6e 64 |oretical|ly sound|
|00000ec0| 2e 0d 2a 2f 0d 64 6f 75 | 62 6c 65 20 42 69 6e 6f |..*/.dou|ble Bino|
|00000ed0| 6d 69 61 6c 4c 6f 77 65 | 72 42 6f 75 6e 64 28 64 |mialLowe|rBound(d|
|00000ee0| 6f 75 62 6c 65 20 50 2c | 6c 6f 6e 67 20 6b 2c 6c |ouble P,|long k,l|
|00000ef0| 6f 6e 67 20 6e 29 0d 2f | 2a 0d 41 72 67 75 6d 65 |ong n)./|*.Argume|
|00000f00| 6e 74 73 20 61 72 65 20 | 74 68 65 20 63 6f 6e 66 |nts are |the conf|
|00000f10| 69 64 65 6e 63 65 20 50 | 2c 20 61 6e 64 20 74 68 |idence P|, and th|
|00000f20| 65 20 6e 75 6d 62 65 72 | 20 6b 20 6f 66 20 68 65 |e number| k of he|
|00000f30| 61 64 73 20 69 6e 20 6e | 20 66 6c 69 70 73 20 6f |ads in n| flips o|
|00000f40| 66 20 61 20 63 6f 69 6e | 2e 0d 54 68 65 20 72 65 |f a coin|..The re|
|00000f50| 74 75 72 6e 65 64 20 76 | 61 6c 75 65 20 70 20 69 |turned v|alue p i|
|00000f60| 73 20 74 68 65 20 6c 6f | 77 65 72 20 65 6e 64 20 |s the lo|wer end |
|00000f70| 6f 66 20 61 20 50 20 63 | 6f 6e 66 69 64 65 6e 63 |of a P c|onfidenc|
|00000f80| 65 20 69 6e 74 65 72 76 | 61 6c 20 6f 6e 20 74 68 |e interv|al on th|
|00000f90| 65 0d 75 6e 64 65 72 6c | 79 69 6e 67 20 70 72 6f |e.underl|ying pro|
|00000fa0| 62 61 62 69 6c 69 74 79 | 20 6f 66 20 61 20 68 65 |bability| of a he|
|00000fb0| 61 64 20 6f 6e 20 61 20 | 73 69 6e 67 6c 65 20 74 |ad on a |single t|
|00000fc0| 72 69 61 6c 2e 0d 2a 2f | 0d 7b 0d 09 64 6f 75 62 |rial..*/|.{..doub|
|00000fd0| 6c 65 20 72 69 67 68 74 | 2c 73 2c 73 73 2c 70 3b |le right|,s,ss,p;|
|00000fe0| 0d 09 0d 09 69 66 28 6b | 3e 30 20 26 26 20 6b 3c |....if(k|>0 && k<|
|00000ff0| 6e 29 7b 0d 09 09 72 69 | 67 68 74 3d 6b 2d 30 2e |n){...ri|ght=k-0.|
|00001000| 35 3b 0d 09 09 73 3d 49 | 6e 76 65 72 73 65 4e 6f |5;...s=I|nverseNo|
|00001010| 72 6d 61 6c 28 73 71 72 | 74 28 50 29 29 3b 0d 09 |rmal(sqr|t(P));..|
|00001020| 09 73 73 3d 73 2a 73 3b | 0d 09 09 70 3d 28 72 69 |.ss=s*s;|...p=(ri|
|00001030| 67 68 74 2b 30 2e 35 2a | 73 73 2d 73 2a 73 71 72 |ght+0.5*|ss-s*sqr|
|00001040| 74 28 72 69 67 68 74 2a | 28 31 2e 30 2d 72 69 67 |t(right*|(1.0-rig|
|00001050| 68 74 2f 6e 29 2b 30 2e | 32 35 2a 73 73 29 29 2f |ht/n)+0.|25*ss))/|
|00001060| 28 6e 2b 73 73 29 3b 0d | 09 09 72 65 74 75 72 6e |(n+ss);.|..return|
|00001070| 20 70 3b 0d 09 7d 0d 09 | 69 66 28 6b 3d 3d 30 29 | p;..}..|if(k==0)|
|00001080| 20 72 65 74 75 72 6e 20 | 30 2e 30 3b 0d 09 69 66 | return |0.0;..if|
|00001090| 28 6b 3d 3d 6e 29 20 72 | 65 74 75 72 6e 20 70 6f |(k==n) r|eturn po|
|000010a0| 77 28 31 2e 30 2d 50 2c | 31 2e 30 2f 6e 29 3b 0d |w(1.0-P,|1.0/n);.|
|000010b0| 09 72 65 74 75 72 6e 20 | 73 71 72 74 28 2d 31 2e |.return |sqrt(-1.|
|000010c0| 30 29 3b 09 2f 2a 20 64 | 6f 6d 61 69 6e 20 65 72 |0);./* d|omain er|
|000010d0| 72 6f 72 20 2a 2f 0d 7d | 0d 0d 64 6f 75 62 6c 65 |ror */.}|..double|
|000010e0| 20 42 69 6e 6f 6d 69 61 | 6c 55 70 70 65 72 42 6f | Binomia|lUpperBo|
|000010f0| 75 6e 64 28 64 6f 75 62 | 6c 65 20 50 2c 6c 6f 6e |und(doub|le P,lon|
|00001100| 67 20 6b 2c 6c 6f 6e 67 | 20 6e 29 0d 2f 2a 0d 41 |g k,long| n)./*.A|
|00001110| 72 67 75 6d 65 6e 74 73 | 20 61 72 65 20 74 68 65 |rguments| are the|
|00001120| 20 63 6f 6e 66 69 64 65 | 6e 63 65 20 50 2c 20 61 | confide|nce P, a|
|00001130| 6e 64 20 74 68 65 20 6e | 75 6d 62 65 72 20 6b 20 |nd the n|umber k |
|00001140| 6f 66 20 68 65 61 64 73 | 20 69 6e 20 6e 20 66 6c |of heads| in n fl|
|00001150| 69 70 73 20 6f 66 20 61 | 20 63 6f 69 6e 2e 0d 54 |ips of a| coin..T|
|00001160| 68 65 20 72 65 74 75 72 | 6e 65 64 20 76 61 6c 75 |he retur|ned valu|
|00001170| 65 20 70 20 69 73 20 74 | 68 65 20 75 70 70 65 72 |e p is t|he upper|
|00001180| 20 65 6e 64 20 6f 66 20 | 61 20 50 20 63 6f 6e 66 | end of |a P conf|
|00001190| 69 64 65 6e 63 65 20 69 | 6e 74 65 72 76 61 6c 20 |idence i|nterval |
|000011a0| 6f 6e 20 74 68 65 0d 75 | 6e 64 65 72 6c 79 69 6e |on the.u|nderlyin|
|000011b0| 67 20 70 72 6f 62 61 62 | 69 6c 69 74 79 20 6f 66 |g probab|ility of|
|000011c0| 20 61 20 68 65 61 64 20 | 6f 6e 20 61 20 73 69 6e | a head |on a sin|
|000011d0| 67 6c 65 20 74 72 69 61 | 6c 2e 0d 2a 2f 0d 7b 0d |gle tria|l..*/.{.|
|000011e0| 09 64 6f 75 62 6c 65 20 | 72 69 67 68 74 2c 73 2c |.double |right,s,|
|000011f0| 73 73 2c 70 3b 0d 09 0d | 09 69 66 28 6b 3e 30 20 |ss,p;...|.if(k>0 |
|00001200| 26 26 20 6b 3c 6e 29 7b | 0d 09 09 72 69 67 68 74 |&& k<n){|...right|
|00001210| 3d 6b 2b 30 2e 35 3b 0d | 09 09 73 3d 49 6e 76 65 |=k+0.5;.|..s=Inve|
|00001220| 72 73 65 4e 6f 72 6d 61 | 6c 28 73 71 72 74 28 50 |rseNorma|l(sqrt(P|
|00001230| 29 29 3b 0d 09 09 73 73 | 3d 73 2a 73 3b 0d 09 09 |));...ss|=s*s;...|
|00001240| 70 3d 28 72 69 67 68 74 | 2b 30 2e 35 2a 73 73 2b |p=(right|+0.5*ss+|
|00001250| 73 2a 73 71 72 74 28 72 | 69 67 68 74 2a 28 31 2e |s*sqrt(r|ight*(1.|
|00001260| 30 2d 72 69 67 68 74 2f | 6e 29 2b 30 2e 32 35 2a |0-right/|n)+0.25*|
|00001270| 73 73 29 29 2f 28 6e 2b | 73 73 29 3b 0d 09 09 72 |ss))/(n+|ss);...r|
|00001280| 65 74 75 72 6e 20 70 3b | 0d 09 7d 0d 09 69 66 28 |eturn p;|..}..if(|
|00001290| 6b 3d 3d 30 29 20 72 65 | 74 75 72 6e 20 31 2e 30 |k==0) re|turn 1.0|
|000012a0| 2d 70 6f 77 28 31 2e 30 | 2d 50 2c 31 2e 30 2f 6e |-pow(1.0|-P,1.0/n|
|000012b0| 29 3b 0d 09 69 66 28 6b | 3d 3d 6e 29 20 72 65 74 |);..if(k|==n) ret|
|000012c0| 75 72 6e 20 31 2e 30 3b | 0d 09 72 65 74 75 72 6e |urn 1.0;|..return|
|000012d0| 20 73 71 72 74 28 2d 31 | 2e 30 29 3b 09 2f 2a 20 | sqrt(-1|.0);./* |
|000012e0| 64 6f 6d 61 69 6e 20 65 | 72 72 6f 72 20 2a 2f 0d |domain e|rror */.|
|000012f0| 7d 0d 0d 23 69 66 20 4e | 45 57 5f 42 49 4e 4f 4d |}..#if N|EW_BINOM|
|00001300| 49 41 4c 09 2f 2a 20 6e | 65 77 20 72 6f 75 74 69 |IAL./* n|ew routi|
|00001310| 6e 65 73 20 74 68 61 74 | 20 72 65 71 75 69 72 65 |nes that| require|
|00001320| 20 4e 75 6d 65 72 69 63 | 61 6c 20 52 65 63 69 70 | Numeric|al Recip|
|00001330| 65 73 20 69 6e 20 43 20 | 2a 2f 0d 09 23 69 6e 63 |es in C |*/..#inc|
|00001340| 6c 75 64 65 20 3c 6e 72 | 2e 68 3e 09 09 09 09 2f |lude <nr|.h>..../|
|00001350| 2a 20 70 72 6f 74 6f 74 | 79 70 65 20 66 6f 72 20 |* protot|ype for |
|00001360| 62 65 74 61 69 28 29 20 | 2a 2f 0d 09 23 69 66 20 |betai() |*/..#if |
|00001370| 30 0d 09 09 76 6f 69 64 | 20 6d 61 69 6e 28 76 6f |0...void| main(vo|
|00001380| 69 64 29 0d 09 09 2f 2a | 20 61 20 71 75 69 63 6b |id).../*| a quick|
|00001390| 20 61 6e 64 20 64 69 72 | 74 79 20 64 72 69 76 65 | and dir|ty drive|
|000013a0| 72 20 74 6f 20 74 65 73 | 74 20 73 6f 6d 65 20 6f |r to tes|t some o|
|000013b0| 66 20 74 68 65 73 65 20 | 72 6f 75 74 69 6e 65 73 |f these |routines|
|000013c0| 20 2a 2f 0d 09 09 7b 0d | 09 09 09 64 6f 75 62 6c | */...{.|...doubl|
|000013d0| 65 20 70 2c 70 55 70 70 | 65 72 2c 70 4c 6f 77 65 |e p,pUpp|er,pLowe|
|000013e0| 72 2c 50 2c 50 55 70 70 | 65 72 2c 50 4c 6f 77 65 |r,P,PUpp|er,PLowe|
|000013f0| 72 3b 0d 09 09 09 69 6e | 74 20 69 2c 6e 2c 6b 3b |r;....in|t i,n,k;|
|00001400| 0d 09 09 09 0d 09 09 09 | 52 65 71 75 69 72 65 28 |........|Require(|
|00001410| 30 29 3b 0d 09 09 09 6e | 3d 31 30 3b 0d 09 09 09 |0);....n|=10;....|
|00001420| 70 3d 2e 32 3b 0d 09 09 | 09 70 4c 6f 77 65 72 3d |p=.2;...|.pLower=|
|00001430| 49 6e 76 65 72 73 65 42 | 69 6e 6f 6d 69 61 6c 28 |InverseB|inomial(|
|00001440| 30 2e 30 35 2c 32 31 2c | 35 30 29 3b 0d 09 09 09 |0.05,21,|50);....|
|00001450| 70 72 69 6e 74 66 28 22 | 25 66 2c 20 41 62 72 61 |printf("|%f, Abra|
|00001460| 6d 6f 77 69 74 7a 20 26 | 20 53 74 65 67 75 6e 20 |mowitz &| Stegun |
|00001470| 70 2e 20 39 36 30 20 45 | 78 61 6d 70 6c 65 20 31 |p. 960 E|xample 1|
|00001480| 38 20 73 61 79 20 74 68 | 69 73 20 73 68 6f 75 6c |8 say th|is shoul|
|00001490| 64 20 62 65 20 30 2e 33 | 30 30 33 2e 5c 6e 22 2c |d be 0.3|003.\n",|
|000014a0| 70 4c 6f 77 65 72 29 3b | 0d 09 09 09 50 3d 30 2e |pLower);|....P=0.|
|000014b0| 39 35 3b 0d 09 09 09 66 | 6f 72 28 69 3d 30 3b 69 |95;....f|or(i=0;i|
|000014c0| 3c 31 30 3b 69 2b 2b 29 | 7b 0d 09 09 09 09 6b 3d |<10;i++)|{.....k=|
|000014d0| 42 69 6e 6f 6d 69 61 6c | 53 61 6d 70 6c 65 28 20 |Binomial|Sample( |
|000014e0| 70 2c 20 6e 29 3b 0d 09 | 09 09 09 70 4c 6f 77 65 |p, n);..|...pLowe|
|000014f0| 72 3d 42 69 6e 6f 6d 69 | 61 6c 4c 6f 77 65 72 42 |r=Binomi|alLowerB|
|00001500| 6f 75 6e 64 28 50 2c 6b | 2c 6e 29 3b 0d 09 09 09 |ound(P,k|,n);....|
|00001510| 09 70 55 70 70 65 72 3d | 42 69 6e 6f 6d 69 61 6c |.pUpper=|Binomial|
|00001520| 55 70 70 65 72 42 6f 75 | 6e 64 28 50 2c 6b 2c 6e |UpperBou|nd(P,k,n|
|00001530| 29 3b 0d 09 09 09 09 50 | 4c 6f 77 65 72 3d 31 2e |);.....P|Lower=1.|
|00001540| 30 2d 42 69 6e 6f 6d 69 | 61 6c 28 70 4c 6f 77 65 |0-Binomi|al(pLowe|
|00001550| 72 2c 6b 2c 6e 29 3b 0d | 09 09 09 09 50 55 70 70 |r,k,n);.|....PUpp|
|00001560| 65 72 3d 42 69 6e 6f 6d | 69 61 6c 28 70 55 70 70 |er=Binom|ial(pUpp|
|00001570| 65 72 2c 6b 2b 31 2c 6e | 29 3b 0d 09 09 09 09 70 |er,k+1,n|);.....p|
|00001580| 72 69 6e 74 66 28 22 6e | 20 25 34 64 20 70 20 25 |rintf("n| %4d p %|
|00001590| 36 2e 34 66 20 25 36 2e | 34 66 b2 25 36 2e 34 66 |6.4f %6.|4f.%6.4f|
|000015a0| b2 25 36 2e 34 66 20 20 | 25 36 2e 34 66 3c 20 3c |.%6.4f |%6.4f< <|
|000015b0| 25 36 2e 34 66 5c 6e 22 | 0d 09 09 09 09 09 2c 6e |%6.4f\n"|......,n|
|000015c0| 2c 70 2c 70 4c 6f 77 65 | 72 2c 6b 2f 28 64 6f 75 |,p,pLowe|r,k/(dou|
|000015d0| 62 6c 65 29 6e 2c 70 55 | 70 70 65 72 2c 50 4c 6f |ble)n,pU|pper,PLo|
|000015e0| 77 65 72 2c 50 55 70 70 | 65 72 29 3b 0d 09 09 09 |wer,PUpp|er);....|
|000015f0| 09 70 4c 6f 77 65 72 3d | 49 6e 76 65 72 73 65 42 |.pLower=|InverseB|
|00001600| 69 6e 6f 6d 69 61 6c 28 | 31 2e 30 2d 73 71 72 74 |inomial(|1.0-sqrt|
|00001610| 28 50 29 2c 6b 2c 6e 29 | 3b 0d 09 09 09 09 70 55 |(P),k,n)|;.....pU|
|00001620| 70 70 65 72 3d 49 6e 76 | 65 72 73 65 42 69 6e 6f |pper=Inv|erseBino|
|00001630| 6d 69 61 6c 28 73 71 72 | 74 28 50 29 2c 6b 2b 31 |mial(sqr|t(P),k+1|
|00001640| 2c 6e 29 3b 0d 09 09 09 | 09 50 4c 6f 77 65 72 3d |,n);....|.PLower=|
|00001650| 31 2e 30 2d 42 69 6e 6f | 6d 69 61 6c 28 70 4c 6f |1.0-Bino|mial(pLo|
|00001660| 77 65 72 2c 6b 2c 6e 29 | 3b 0d 09 09 09 09 50 55 |wer,k,n)|;.....PU|
|00001670| 70 70 65 72 3d 42 69 6e | 6f 6d 69 61 6c 28 70 55 |pper=Bin|omial(pU|
|00001680| 70 70 65 72 2c 6b 2b 31 | 2c 6e 29 3b 0d 09 09 09 |pper,k+1|,n);....|
|00001690| 09 70 72 69 6e 74 66 28 | 22 20 20 25 34 64 20 70 |.printf(|" %4d p|
|000016a0| 20 25 36 2e 34 66 20 25 | 36 2e 34 66 b2 25 36 2e | %6.4f %|6.4f.%6.|
|000016b0| 34 66 b2 25 36 2e 34 66 | 20 20 25 36 2e 34 66 3c |4f.%6.4f| %6.4f<|
|000016c0| 20 3c 25 36 2e 34 66 5c | 6e 22 0d 09 09 09 09 09 | <%6.4f\|n"......|
|000016d0| 2c 6e 2c 70 2c 70 4c 6f | 77 65 72 2c 6b 2f 28 64 |,n,p,pLo|wer,k/(d|
|000016e0| 6f 75 62 6c 65 29 6e 2c | 70 55 70 70 65 72 2c 50 |ouble)n,|pUpper,P|
|000016f0| 4c 6f 77 65 72 2c 50 55 | 70 70 65 72 29 3b 0d 09 |Lower,PU|pper);..|
|00001700| 09 09 7d 0d 09 09 7d 0d | 09 23 65 6e 64 69 66 0d |..}...}.|.#endif.|
|00001710| 09 0d 09 64 6f 75 62 6c | 65 20 42 69 6e 6f 6d 69 |...doubl|e Binomi|
|00001720| 61 6c 28 64 6f 75 62 6c | 65 20 70 2c 6c 6f 6e 67 |al(doubl|e p,long|
|00001730| 20 6b 2c 6c 6f 6e 67 20 | 6e 29 0d 09 2f 2a 0d 09 | k,long |n)../*..|
|00001740| 52 65 74 75 72 6e 73 20 | 74 68 65 20 70 72 6f 62 |Returns |the prob|
|00001750| 61 62 69 6c 69 74 79 20 | 6f 66 20 6b 20 6f 72 20 |ability |of k or |
|00001760| 6d 6f 72 65 20 68 65 61 | 64 73 20 69 6e 20 6e 20 |more hea|ds in n |
|00001770| 66 6c 69 70 73 2c 20 77 | 68 65 72 65 20 70 72 6f |flips, w|here pro|
|00001780| 62 61 62 69 6c 69 74 79 | 20 6f 66 0d 09 65 61 63 |bability| of..eac|
|00001790| 68 20 68 65 61 64 73 20 | 69 73 20 70 2e 20 54 68 |h heads |is p. Th|
|000017a0| 69 73 20 69 64 65 6e 74 | 69 74 79 20 61 70 70 65 |is ident|ity appe|
|000017b0| 61 72 73 20 69 6e 20 4e | 75 6d 65 72 69 63 61 6c |ars in N|umerical|
|000017c0| 20 52 65 63 69 70 65 73 | 20 69 6e 20 43 2c 20 70 | Recipes| in C, p|
|000017d0| 61 67 65 20 31 38 32 2c | 20 61 6e 64 0d 09 69 6e |age 182,| and..in|
|000017e0| 20 41 62 72 61 6d 6f 77 | 69 74 7a 20 61 6e 64 20 | Abramow|itz and |
|000017f0| 53 74 65 67 75 6e 2c 20 | 70 2e 20 39 34 35 2e 20 |Stegun, |p. 945. |
|00001800| 45 71 2e 32 36 2e 35 2e | 32 34 2e 0d 09 2a 2f 0d |Eq.26.5.|24...*/.|
|00001810| 09 7b 0d 09 09 69 66 28 | 6b 3e 6e 29 72 65 74 75 |.{...if(|k>n)retu|
|00001820| 72 6e 20 30 2e 30 3b 0d | 09 09 69 66 28 6b 3c 3d |rn 0.0;.|..if(k<=|
|00001830| 30 4c 29 72 65 74 75 72 | 6e 20 31 2e 30 3b 0d 09 |0L)retur|n 1.0;..|
|00001840| 09 69 66 28 70 3d 3d 30 | 2e 30 29 7b 0d 09 09 09 |.if(p==0|.0){....|
|00001850| 69 66 28 6b 3d 3d 30 29 | 72 65 74 75 72 6e 20 31 |if(k==0)|return 1|
|00001860| 2e 30 3b 0d 09 09 09 65 | 6c 73 65 20 72 65 74 75 |.0;....e|lse retu|
|00001870| 72 6e 20 30 2e 30 3b 0d | 09 09 7d 0d 09 09 69 66 |rn 0.0;.|..}...if|
|00001880| 28 70 3d 3d 31 2e 30 29 | 72 65 74 75 72 6e 20 31 |(p==1.0)|return 1|
|00001890| 2e 30 3b 0d 09 09 72 65 | 74 75 72 6e 20 49 6e 63 |.0;...re|turn Inc|
|000018a0| 6f 6d 70 6c 65 74 65 42 | 65 74 61 28 70 2c 6b 2c |ompleteB|eta(p,k,|
|000018b0| 6e 2d 6b 2b 31 29 3b 0d | 09 7d 0d 09 0d 09 64 6f |n-k+1);.|.}....do|
|000018c0| 75 62 6c 65 20 42 69 6e | 6f 6d 69 61 6c 50 64 66 |uble Bin|omialPdf|
|000018d0| 28 64 6f 75 62 6c 65 20 | 70 2c 6c 6f 6e 67 20 6b |(double |p,long k|
|000018e0| 2c 6c 6f 6e 67 20 6e 29 | 0d 09 2f 2a 0d 09 52 65 |,long n)|../*..Re|
|000018f0| 74 75 72 6e 73 20 74 68 | 65 20 70 72 6f 62 61 62 |turns th|e probab|
|00001900| 69 6c 69 74 79 20 6f 66 | 20 65 78 61 63 74 6c 79 |ility of| exactly|
|00001910| 20 6b 20 68 65 61 64 73 | 20 69 6e 20 6e 20 66 6c | k heads| in n fl|
|00001920| 69 70 73 2c 20 77 68 65 | 72 65 20 70 72 6f 62 61 |ips, whe|re proba|
|00001930| 62 69 6c 69 74 79 20 6f | 66 0d 09 65 61 63 68 20 |bility o|f..each |
|00001940| 68 65 61 64 73 20 69 73 | 20 70 2e 20 0d 09 49 27 |heads is| p. ..I'|
|00001950| 6d 20 6e 6f 74 20 72 65 | 61 6c 6c 79 20 73 75 72 |m not re|ally sur|
|00001960| 65 20 77 68 65 74 68 65 | 72 20 74 68 69 73 20 69 |e whethe|r this i|
|00001970| 73 20 6d 6f 72 65 20 63 | 6f 6d 70 75 74 61 74 69 |s more c|omputati|
|00001980| 6f 6e 61 6c 6c 79 20 65 | 66 66 69 63 69 65 6e 74 |onally e|fficient|
|00001990| 20 74 68 61 6e 20 63 6f | 6d 70 75 74 69 6e 67 0d | than co|mputing.|
|000019a0| 09 69 74 20 64 69 72 65 | 63 74 6c 79 2c 20 66 72 |.it dire|ctly, fr|
|000019b0| 6f 6d 20 74 68 65 20 64 | 65 66 69 6e 69 74 69 6f |om the d|efinitio|
|000019c0| 6e 20 6f 66 20 74 68 65 | 20 62 69 6e 6f 6d 69 61 |n of the| binomia|
|000019d0| 6c 20 64 69 73 74 72 69 | 62 75 74 69 6f 6e 2c 20 |l distri|bution, |
|000019e0| 62 75 74 20 69 74 20 69 | 73 20 76 65 72 79 20 65 |but it i|s very e|
|000019f0| 61 73 79 0d 09 74 6f 20 | 77 72 69 74 65 2c 20 61 |asy..to |write, a|
|00001a00| 6e 64 20 61 76 6f 69 64 | 73 20 74 68 65 20 64 69 |nd avoid|s the di|
|00001a10| 66 66 69 63 75 6c 74 79 | 20 6f 66 20 63 6f 6d 70 |fficulty| of comp|
|00001a20| 75 74 69 6e 67 20 74 68 | 65 20 62 69 6e 6f 6d 69 |uting th|e binomi|
|00001a30| 61 6c 20 63 6f 65 66 66 | 69 63 69 65 6e 74 0d 09 |al coeff|icient..|
|00001a40| 77 69 74 68 6f 75 74 20 | 6f 76 65 72 66 6c 6f 77 |without |overflow|
|00001a50| 2e 0d 09 2a 2f 0d 09 7b | 0d 09 09 69 66 28 6b 3c |...*/..{|...if(k<|
|00001a60| 30 4c 20 7c 7c 20 6b 3e | 6e 29 72 65 74 75 72 6e |0L || k>|n)return|
|00001a70| 20 30 2e 30 3b 0d 09 09 | 69 66 28 6b 3d 3d 6e 29 | 0.0;...|if(k==n)|
|00001a80| 20 72 65 74 75 72 6e 20 | 70 6f 77 28 70 2c 6e 29 | return |pow(p,n)|
|00001a90| 3b 0d 09 09 72 65 74 75 | 72 6e 20 42 69 6e 6f 6d |;...retu|rn Binom|
|00001aa0| 69 61 6c 28 70 2c 6b 2c | 6e 29 2d 42 69 6e 6f 6d |ial(p,k,|n)-Binom|
|00001ab0| 69 61 6c 28 70 2c 6b 2b | 31 2c 6e 29 3b 0d 09 7d |ial(p,k+|1,n);..}|
|00001ac0| 0d 09 0d 09 64 6f 75 62 | 6c 65 20 49 6e 76 65 72 |....doub|le Inver|
|00001ad0| 73 65 42 69 6e 6f 6d 69 | 61 6c 28 64 6f 75 62 6c |seBinomi|al(doubl|
|00001ae0| 65 20 50 2c 6c 6f 6e 67 | 20 6b 2c 6c 6f 6e 67 20 |e P,long| k,long |
|00001af0| 6e 29 0d 09 2f 2a 20 52 | 65 74 75 72 6e 73 20 74 |n)../* R|eturns t|
|00001b00| 68 65 20 50 2d 74 68 20 | 71 75 61 6e 74 69 6c 65 |he P-th |quantile|
|00001b10| 20 66 6f 72 20 74 68 65 | 20 70 72 6f 62 61 62 69 | for the| probabi|
|00001b20| 6c 69 74 79 20 70 20 6f | 66 20 61 20 68 65 61 64 |lity p o|f a head|
|00001b30| 73 2c 0d 09 67 69 76 65 | 6e 20 6b 20 68 65 61 64 |s,..give|n k head|
|00001b40| 73 20 69 6e 20 6e 20 66 | 6c 69 70 73 2e 20 0d 09 |s in n f|lips. ..|
|00001b50| 70 55 70 70 65 72 3d 49 | 6e 76 65 72 73 65 42 69 |pUpper=I|nverseBi|
|00001b60| 6e 6f 6d 69 61 6c 28 30 | 2e 39 37 35 2c 6b 2b 31 |nomial(0|.975,k+1|
|00001b70| 2c 6e 29 20 69 73 20 61 | 20 39 37 2e 35 25 20 63 |,n) is a| 97.5% c|
|00001b80| 6f 6e 66 69 64 65 6e 63 | 65 20 75 70 70 65 72 20 |onfidenc|e upper |
|00001b90| 62 6f 75 6e 64 20 6f 6e | 20 70 0d 09 70 4c 6f 77 |bound on| p..pLow|
|00001ba0| 65 72 3d 49 6e 76 65 72 | 73 65 42 69 6e 6f 6d 69 |er=Inver|seBinomi|
|00001bb0| 61 6c 28 30 2e 30 32 35 | 2c 6b 2c 6e 29 20 69 73 |al(0.025|,k,n) is|
|00001bc0| 20 61 20 39 37 2e 35 25 | 20 63 6f 6e 66 69 64 65 | a 97.5%| confide|
|00001bd0| 6e 63 65 20 6c 6f 77 65 | 72 20 62 6f 75 6e 64 20 |nce lowe|r bound |
|00001be0| 6f 6e 20 70 0d 09 54 61 | 6b 65 6e 20 74 6f 67 65 |on p..Ta|ken toge|
|00001bf0| 74 68 65 72 20 74 68 65 | 73 65 20 62 6f 75 6e 64 |ther the|se bound|
|00001c00| 73 20 66 6f 72 6d 20 61 | 20 39 37 2e 35 25 2a 39 |s form a| 97.5%*9|
|00001c10| 37 2e 35 25 3d 39 35 25 | 20 63 6f 6e 66 69 64 65 |7.5%=95%| confide|
|00001c20| 6e 63 65 20 69 6e 74 65 | 72 76 61 6c 3a 20 5b 70 |nce inte|rval: [p|
|00001c30| 4c 6f 77 65 72 2c 70 55 | 70 70 65 72 5d 2e 0d 09 |Lower,pU|pper]...|
|00001c40| 2a 2f 0d 09 7b 0d 09 23 | 69 66 20 30 0d 09 09 72 |*/..{..#|if 0...r|
|00001c50| 65 74 75 72 6e 20 49 6e | 76 65 72 73 65 49 6e 63 |eturn In|verseInc|
|00001c60| 6f 6d 70 6c 65 74 65 42 | 65 74 61 28 50 2c 6b 2c |ompleteB|eta(P,k,|
|00001c70| 6e 2d 6b 2b 31 29 3b 0d | 09 23 65 6c 73 65 0d 09 |n-k+1);.|.#else..|
|00001c80| 09 2f 2a 0d 09 09 54 68 | 69 73 20 73 69 6d 70 6c |./*...Th|is simpl|
|00001c90| 65 2d 6d 69 6e 64 65 64 | 20 62 69 73 65 63 74 69 |e-minded| bisecti|
|00001ca0| 6f 6e 20 72 6f 75 74 69 | 6e 65 20 69 73 20 73 6c |on routi|ne is sl|
|00001cb0| 6f 77 2c 20 62 75 74 20 | 69 74 73 20 61 6e 73 77 |ow, but |its answ|
|00001cc0| 65 72 20 69 73 20 61 63 | 63 75 72 61 74 65 0d 09 |er is ac|curate..|
|00001cd0| 09 74 6f 20 77 69 74 68 | 69 6e 20 b1 31 65 2d 31 |.to with|in .1e-1|
|00001ce0| 30 2e 20 0d 09 09 2a 2f | 0d 09 09 64 6f 75 62 6c |0. ...*/|...doubl|
|00001cf0| 65 20 6c 6f 77 3d 30 2e | 30 2c 68 69 67 68 3d 31 |e low=0.|0,high=1|
|00001d00| 2e 30 2c 6d 69 64 3b 0d | 09 09 64 6f 75 62 6c 65 |.0,mid;.|..double|
|00001d10| 20 66 3b 0d 09 09 69 6e | 74 20 69 3b 0d 09 09 0d | f;...in|t i;....|
|00001d20| 09 09 66 6f 72 28 69 3d | 30 3b 69 3c 33 30 3b 69 |..for(i=|0;i<30;i|
|00001d30| 2b 2b 29 7b 0d 09 09 09 | 6d 69 64 3d 28 6c 6f 77 |++){....|mid=(low|
|00001d40| 2b 68 69 67 68 29 2f 32 | 2e 30 3b 0d 09 09 09 66 |+high)/2|.0;....f|
|00001d50| 3d 42 69 6e 6f 6d 69 61 | 6c 28 6d 69 64 2c 6b 2c |=Binomia|l(mid,k,|
|00001d60| 6e 29 3b 0d 09 09 09 69 | 66 28 66 3e 50 29 68 69 |n);....i|f(f>P)hi|
|00001d70| 67 68 3d 6d 69 64 3b 0d | 09 09 09 65 6c 73 65 20 |gh=mid;.|...else |
|00001d80| 6c 6f 77 3d 6d 69 64 3b | 0d 09 09 7d 0d 09 09 72 |low=mid;|...}...r|
|00001d90| 65 74 75 72 6e 20 28 6c | 6f 77 2b 68 69 67 68 29 |eturn (l|ow+high)|
|00001da0| 2f 32 2e 30 3b 0d 09 23 | 65 6e 64 69 66 0d 09 7d |/2.0;..#|endif..}|
|00001db0| 0d 0d 09 64 6f 75 62 6c | 65 20 49 6e 63 6f 6d 70 |...doubl|e Incomp|
|00001dc0| 6c 65 74 65 42 65 74 61 | 28 64 6f 75 62 6c 65 20 |leteBeta|(double |
|00001dd0| 78 2c 64 6f 75 62 6c 65 | 20 61 2c 64 6f 75 62 6c |x,double| a,doubl|
|00001de0| 65 20 62 29 0d 09 2f 2a | 0d 09 54 68 65 20 69 6e |e b)../*|..The in|
|00001df0| 63 6f 6d 70 6c 65 74 65 | 20 62 65 74 61 20 66 75 |complete| beta fu|
|00001e00| 6e 63 74 69 6f 6e 20 49 | 78 28 61 2c 62 29 2e 0d |nction I|x(a,b)..|
|00001e10| 09 54 68 65 20 4e 75 6d | 65 72 69 63 61 6c 20 52 |.The Num|erical R|
|00001e20| 65 63 69 70 65 73 20 72 | 6f 75 74 69 6e 65 20 61 |ecipes r|outine a|
|00001e30| 73 73 75 6d 65 73 20 61 | 3e 30 2e 20 54 68 69 73 |ssumes a|>0. This|
|00001e40| 20 77 6f 72 6b 20 61 72 | 6f 75 6e 64 20 69 73 20 | work ar|ound is |
|00001e50| 74 61 6b 65 6e 20 66 72 | 6f 6d 0d 09 41 62 72 61 |taken fr|om..Abra|
|00001e60| 6d 6f 77 69 74 7a 65 20 | 61 6e 64 20 53 74 65 67 |mowitze |and Steg|
|00001e70| 75 6e 20 70 61 67 65 20 | 39 34 34 2c 20 45 71 2e |un page |944, Eq.|
|00001e80| 20 32 36 2e 35 2e 31 36 | 2e 0d 09 2a 2f 0d 09 7b | 26.5.16|...*/..{|
|00001e90| 0d 09 09 69 66 28 61 3e | 30 2e 30 29 72 65 74 75 |...if(a>|0.0)retu|
|00001ea0| 72 6e 20 62 65 74 61 69 | 28 61 2c 62 2c 78 29 3b |rn betai|(a,b,x);|
|00001eb0| 09 2f 2a 20 4e 75 6d 65 | 72 69 63 61 6c 20 52 65 |./* Nume|rical Re|
|00001ec0| 63 69 70 65 73 20 69 6e | 20 43 20 2a 2f 0d 09 09 |cipes in| C */...|
|00001ed0| 65 6c 73 65 20 72 65 74 | 75 72 6e 20 49 6e 63 6f |else ret|urn Inco|
|00001ee0| 6d 70 6c 65 74 65 42 65 | 74 61 28 78 2c 61 2b 31 |mpleteBe|ta(x,a+1|
|00001ef0| 2e 30 2c 62 29 0d 09 09 | 09 2b 65 78 70 28 67 61 |.0,b)...|.+exp(ga|
|00001f00| 6d 6d 6c 6e 28 61 2b 62 | 29 2d 67 61 6d 6d 6c 6e |mmln(a+b|)-gammln|
|00001f10| 28 61 2b 31 2e 30 29 2d | 67 61 6d 6d 6c 6e 28 62 |(a+1.0)-|gammln(b|
|00001f20| 29 2b 61 2a 6c 6f 67 28 | 78 29 2b 62 2a 6c 6f 67 |)+a*log(|x)+b*log|
|00001f30| 28 31 2e 30 2d 78 29 29 | 3b 0d 09 7d 0d 09 0d 09 |(1.0-x))|;..}....|
|00001f40| 64 6f 75 62 6c 65 20 49 | 6e 76 65 72 73 65 49 6e |double I|nverseIn|
|00001f50| 63 6f 6d 70 6c 65 74 65 | 42 65 74 61 28 64 6f 75 |complete|Beta(dou|
|00001f60| 62 6c 65 20 70 2c 64 6f | 75 62 6c 65 20 61 2c 64 |ble p,do|uble a,d|
|00001f70| 6f 75 62 6c 65 20 62 29 | 0d 09 2f 2a 0d 09 54 68 |ouble b)|../*..Th|
|00001f80| 69 73 20 73 69 6d 70 6c | 65 2d 6d 69 6e 64 65 64 |is simpl|e-minded|
|00001f90| 20 62 69 73 65 63 74 69 | 6f 6e 20 72 6f 75 74 69 | bisecti|on routi|
|00001fa0| 6e 65 20 69 73 20 73 6c | 6f 77 2c 20 62 75 74 20 |ne is sl|ow, but |
|00001fb0| 69 74 73 20 61 6e 73 77 | 65 72 20 69 73 20 61 63 |its answ|er is ac|
|00001fc0| 63 75 72 61 74 65 0d 09 | 74 6f 20 77 69 74 68 69 |curate..|to withi|
|00001fd0| 6e 20 b1 31 65 2d 31 30 | 2e 20 0d 09 2a 2f 0d 09 |n .1e-10|. ..*/..|
|00001fe0| 7b 0d 09 09 64 6f 75 62 | 6c 65 20 6c 6f 77 3d 30 |{...doub|le low=0|
|00001ff0| 2e 30 2c 68 69 67 68 3d | 31 2e 30 2c 6d 69 64 3b |.0,high=|1.0,mid;|
|00002000| 0d 09 09 64 6f 75 62 6c | 65 20 66 3b 0d 09 09 69 |...doubl|e f;...i|
|00002010| 6e 74 20 69 3b 0d 09 09 | 0d 09 09 66 6f 72 28 69 |nt i;...|...for(i|
|00002020| 3d 30 3b 69 3c 33 30 3b | 69 2b 2b 29 7b 0d 09 09 |=0;i<30;|i++){...|
|00002030| 09 6d 69 64 3d 28 6c 6f | 77 2b 68 69 67 68 29 2f |.mid=(lo|w+high)/|
|00002040| 32 2e 30 3b 0d 09 09 09 | 66 3d 49 6e 63 6f 6d 70 |2.0;....|f=Incomp|
|00002050| 6c 65 74 65 42 65 74 61 | 28 6d 69 64 2c 61 2c 62 |leteBeta|(mid,a,b|
|00002060| 29 3b 0d 09 09 09 69 66 | 28 66 3e 70 29 68 69 67 |);....if|(f>p)hig|
|00002070| 68 3d 6d 69 64 3b 0d 09 | 09 09 65 6c 73 65 20 6c |h=mid;..|..else l|
|00002080| 6f 77 3d 6d 69 64 3b 0d | 09 09 7d 0d 09 09 72 65 |ow=mid;.|..}...re|
|00002090| 74 75 72 6e 20 28 6c 6f | 77 2b 68 69 67 68 29 2f |turn (lo|w+high)/|
|000020a0| 32 2e 30 3b 0d 09 7d 0d | 09 0d 23 65 6e 64 69 66 |2.0;..}.|..#endif|
|000020b0| 0d 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000020c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000020d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000020e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000020f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002100| 00 00 01 00 00 00 01 6e | 00 00 00 6e 00 00 00 3e |.......n|...n...>|
|00002110| 70 79 72 69 67 68 74 20 | 28 63 29 20 31 39 39 30 |pyright |(c) 1990|
|00002120| 20 44 65 6e 69 73 20 47 | 2e 20 50 65 6c 6c 69 0d | Denis G|. Pelli.|
|00002130| 0a 42 69 6e 6f 6d 69 61 | 6c 2e 63 6d 02 00 00 00 |.Binomia|l.cm....|
|00002140| 54 45 58 54 4b 41 48 4c | 00 00 00 00 00 00 00 00 |TEXTKAHL|........|
|00002150| 00 00 54 45 58 54 4b 41 | 48 4c 00 00 00 00 00 00 |..TEXTKA|HL......|
|00002160| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002170| 00 00 a7 e5 d5 ac 00 00 | 00 00 00 00 01 ac 0d 74 |........|.......t|
|00002180| 68 65 20 75 6e 64 65 72 | 6c 79 69 6e 67 20 62 69 |he under|lying bi|
|00002190| 6e 6f 6d 69 61 6c 20 70 | 72 6f 62 61 62 69 6c 69 |nomial p|robabili|
|000021a0| 74 79 20 61 73 73 75 6d | 65 64 20 74 6f 20 68 61 |ty assum|ed to ha|
|000021b0| 76 65 20 67 65 6e 65 72 | 61 74 65 64 20 74 68 65 |ve gener|ated the|
|000021c0| 20 64 61 74 61 2e 0d 54 | 72 61 6e 73 6c 61 74 65 | data..T|ranslate|
|000021d0| 64 20 66 72 6f 6d 20 74 | 68 65 20 46 4f 52 54 52 |d from t|he FORTR|
|000021e0| 41 4e 20 73 74 61 74 65 | 6d 65 6e 74 20 66 75 6e |AN state|ment fun|
|000021f0| 63 74 69 6f 6e 73 20 69 | 6e 20 51 55 49 43 4b 32 |ctions i|n QUICK2|
|00002200| 00 00 00 48 00 09 4d 6f | 6e 61 63 6f 00 ea 00 3d |...H..Mo|naco...=|
|00002210| 00 00 00 14 00 01 a7 dc | 00 0a 00 48 00 96 00 d2 |........|...H....|
|00002220| 01 ea 65 73 00 00 00 06 | 00 04 00 50 00 20 01 dd |..es....|...P. ..|
|00002230| 02 3d 00 50 00 20 01 dd | 02 3d a6 1f 48 23 00 00 |.=.P. ..|.=..H#..|
|00002240| 0f 09 00 00 10 e2 00 00 | 0e c9 01 00 00 00 00 1e |........|........|
|00002250| 00 50 00 20 01 dd 02 3d | 00 50 00 20 01 dd 02 3d |.P. ...=|.P. ...=|
|00002260| 00 00 0e c9 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002270| 01 00 00 00 01 6e 00 00 | 00 6e 00 00 00 3e 00 3f |.....n..|.n...>.?|
|00002280| 9d 04 09 8e 00 00 00 1c | 00 3e 00 00 4d 50 53 52 |........|.>..MPSR|
|00002290| 00 01 00 0a 03 ed ff ff | 00 00 00 00 00 00 00 00 |........|........|
|000022a0| 03 f0 ff ff 00 00 00 4c | 00 41 9c 54 00 00 00 00 |.......L|.A.T....|
|000022b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000022c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000022d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000022e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000022f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+